Update API Rate Limit
Used to update the rate limiting configuration for an API tool. Rate limiting helps prevent abuse, manage API costs, and ensure fair usage across multiple requests.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/tools/api-rate-limit/{tool_id} |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/tools/api-rate-limit/tool_weather_api' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"Enabled": true,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}'
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| tool_id | string | Yes | Unique identifier of the API tool to configure rate limiting for. |
Request Body
Request Body Schema
{
"Enabled": false,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| Enabled | boolean | Yes | Whether rate limiting is enabled for this tool. |
| RequestsPerMinute | integer | No | Maximum number of requests allowed per minute. Default: 100. |
| RequestsPerHour | integer | No | Maximum number of requests allowed per hour. Default: 6000. |
| BurstSize | integer | No | Number of requests allowed in a burst. Default: 10. |
Understanding Rate Limit Parameters
RequestsPerMinute: Controls short-term traffic to prevent spam or accidental overuse. If you expect quick bursts of activity, set this higher.
RequestsPerHour: Controls long-term usage to stay within API provider limits and manage costs. This is your primary throttle for overall usage.
BurstSize: Allows temporary spikes above the per-minute limit. For example, if RequestsPerMinute is 60 and BurstSize is 10, the system can handle 70 requests in a single minute, but subsequent minutes will be throttled until the average drops below 60/min.
Example Scenarios:
- High-frequency API:
RequestsPerMinute: 300, RequestsPerHour: 10000, BurstSize: 50 - Standard API:
RequestsPerMinute: 100, RequestsPerHour: 6000, BurstSize: 10 - Rate-sensitive API:
RequestsPerMinute: 10, RequestsPerHour: 500, BurstSize: 2 - Free tier API:
RequestsPerMinute: 5, RequestsPerHour: 100, BurstSize: 1
Response
Success Response (200 OK)
Returns an object containing the rate limit configuration update status.
{
"is_success": true,
"item_id": "tool_weather_api",
"detail": "API rate limit configuration updated successfully",
"error": {}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_success | boolean | Indicates whether the operation was successful. |
| item_id | string | Unique identifier of the tool that was configured. |
| detail | string | Success or failure message with additional context. |
| error | object | Error details if the operation failed (empty if successful). |
Example Configurations
High-Volume API
{
"Enabled": true,
"RequestsPerMinute": 500,
"RequestsPerHour": 20000,
"BurstSize": 100
}
Use case: Internal APIs with high availability and no strict cost constraints
Standard Production API
{
"Enabled": true,
"RequestsPerMinute": 100,
"RequestsPerHour": 6000,
"BurstSize": 10
}
Use case: Typical third-party API with moderate usage limits
Cost-Sensitive API
{
"Enabled": true,
"RequestsPerMinute": 20,
"RequestsPerHour": 1000,
"BurstSize": 5
}
Use case: Expensive APIs where you need to carefully control costs
Free Tier API
{
"Enabled": true,
"RequestsPerMinute": 5,
"RequestsPerHour": 100,
"BurstSize": 2
}
Use case: Free tier APIs with strict rate limits
Development/Testing
{
"Enabled": false,
"RequestsPerMinute": 1000,
"RequestsPerHour": 50000,
"BurstSize": 100
}
Use case: Development environment where rate limiting is disabled or very permissive
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid.
{
"detail": [
{
"loc": [
"body",
"RequestsPerMinute"
],
"msg": "ensure this value is greater than 0",
"type": "value_error.number.not_gt"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., path, body). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | Successful Response | Success |
| 400 | Bad Request - Invalid rate limit configuration | Bad Request |
| 404 | Not Found - Tool does not exist | Not Found |
| 422 | Validation Error - Invalid request parameters | Unprocessable Entity |
Rate Limiting Best Practices
Align with API Provider Limits: Set your rate limits below the API provider's limits to avoid hitting their restrictions.
Monitor Usage: Track actual API usage patterns to optimize rate limit settings.
Handle Rate Limit Errors: Implement proper error handling and retry logic with exponential backoff when rate limits are hit.
User Communication: If rate limits affect user experience, communicate clearly about limitations and wait times.
Gradual Rollout: Start with conservative limits and gradually increase based on observed behavior and needs.
Cost Management: Set rate limits that align with your budget for paid APIs.
Rate Limit Enforcement
- Rate limits are enforced per tool, not per agent or user
- Requests exceeding the limit will receive a 429 (Too Many Requests) error
- The system uses a sliding window algorithm to track request counts
- Burst capacity allows temporary spikes but is recovered over time
- Disabling rate limiting (
Enabled: false) removes all throttling for the tool